package logic

import (
	"context"
	"mall/app/product/cmd/rpc/pb"

	"mall/app/product/cmd/api/internal/svc"
	"mall/app/product/cmd/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type GetProductDetailLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewGetProductDetailLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetProductDetailLogic {
	return &GetProductDetailLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *GetProductDetailLogic) GetProductDetail(req *types.GetProductDetailReq) (*pb.GetProductDetailResp, error) {
	detail, err := l.svcCtx.ProductRpc.GetProductDetail(l.ctx, &pb.GetProductDetailReq{
		SkuId: 1,
	})
	return detail, err
}
